
using System;

namespace Tomboy
{
	
	public class TomboyProviderLoader
	{
	
		static TomboyDataProvider provider=null;
		
		static public TomboyDataProvider getProvider()
		{
		
			if (provider==null) {
			
				System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFrom("provider.dll");
				object obj;
				Type[] types = asm.GetTypes();

				foreach (Type ty in types){
					System.Console.WriteLine(ty.FullName);
					if (!ty.IsAbstract) {
						System.Console.WriteLine("Crea Istanza");
						obj = Activator.CreateInstance(ty);
						System.Console.WriteLine("Istanza Creata di classe "+obj.GetType().ToString());
						provider = (TomboyDataProvider)obj;
					}
				}
			}
			return provider;
		}
	}
}
